package org.helyx.gae.getabike;

import org.helyx.gae.getabike.model.City;
import org.helyx.gae.getabike.registry.DefaultRegistry;
import org.helyx.gae.getabike.registry.Registry;
import org.springframework.beans.factory.FactoryBean;

public class CityRegistryFactory implements FactoryBean<Registry<String, City>> {

	@Override
	public Registry<String, City> getObject() throws Exception {
		City city = null;
		
		city = new City();
		
		city.setKey("paris");
		city.setName("Paris");
		city.setType("VELIB");
		city.setServiceName("Vélib'");
		city.setStationListUri("http://www.velib.paris.fr/service/carto/");
		city.setWebSiteUrl("http://www.velib.paris.fr");
		city.setStationDetailsUri("http://www.velib.paris.fr/service/stationdetails/{1}");

		city.setBonus(true);
		city.setState(true);
		city.setTpe(true);
		city.setLocalization(true);
		
		DefaultRegistry<String, City> cityRegistry = new DefaultRegistry<String, City>();
		cityRegistry.put(city.getKey(), city);

		return cityRegistry;
	}

	@Override
	public Class<?> getObjectType() {
		return Registry.class;
	}

	@Override
	public boolean isSingleton() {
		return true;
	}

}
